**** Main Analysis of Voyage Level Data 
**** "Local Standards, Behavioral Adjustments, and Welfare: Evaluating California’s Ocean-Going Vessel Fuel Rule"
**** Richard Klotz and Julia Berazneva
**** Updated 9/2021 

clear *
macro drop _all
set more off , permanently
set autotabgraphs on , permanently // graphs open as tabs

*display options
*set scheme simple // setting scheme for graphs - personal one
scalar my_ts_axis = "#7"

/*
* Loading packages
ssc install outreg2 , replace
ssc install coefplot , replace
ssc install reghdfe , replace
ssc install parmest , replace
ssc install lgraph , replace
ssc install tabout , all
ssc install egenmore , replace
ssc install rowsort , replace
*/

/*
* Mac
local user_dir "/Volumes/GoogleDrive/"
global base_dir "`user_dir'My Drive/Boats/"
*/

* PC
local user_dir "H:/"
global base_dir "`user_dir'My Drive/Boats/ReplicationCode"

* location of results folder
global work_dir = "${base_dir}/results"
*global local_work_dir = "${base_dir}/working"

cd "${work_dir}"

local analysis_dta = "${base_dir}/data/final/CA_tracks_fuel.dta"

*** Voyage Level Analysis ************

* making output directories
capture mkdir "${base_dir}/results"
capture mkdir "${base_dir}/results/sum_stats"

* Prepare Data
*do "${base_dir}/analysis_code/prepare_data.do" "`analysis_dta'"
use "`analysis_dta'" , replace

* Analysis
* Main figures and tables
do "${base_dir}/analysis_code/CA_ECA_analysis.do"

* Motivational Figures 
* Figures 2 and A.17
*do "${base_dir}/analysis_code/create_motivational_figures.do"

* Summary Stats 
* Tables A.1 and A.2
*do "${base_dir}/analysis_code/create_summ_stats_tables.do"


*** Speed bins analysis 
* Figure 7 and Figure A.8
clear 
do "${base_dir}/analysis_code/speed_bins.do"

*** Within port analysis
* Table A.16
clear 
do "${base_dir}/analysis_code/analyze_within_port.do"
